package com.smile.realtime.utils

import java.io.InputStreamReader
import java.nio.charset.StandardCharsets
import java.util.Properties

/**
 * Author: smile
 * Date: 2022/2/11
 * Desc: 读取配置文件的工具类
 */
object MyPropertiesUtil {

  def main(args: Array[String]): Unit = {
    val properties = MyPropertiesUtil.load("config.properties")
    println(properties.getProperty("kafka.broker.list"))

  }



  //加载特殊配置属性
  def load(propertiesName:String):Properties ={
    val properties = new Properties()
    properties.load(new InputStreamReader(
      Thread.currentThread().getContextClassLoader.getResourceAsStream(propertiesName)
      ,StandardCharsets.UTF_8))
    properties
  }

}
